#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int NumSum(int n)
    {
        if (n < 10)
        {
            return n;
        }
        return n % 10 + NumSum(n / 10);
    }
    int countBalls(int lowLimit, int highLimit) {
        map<int, int> m1;
        for (int i = lowLimit; i <= highLimit; ++i)
        {
            int Sum = NumSum(i);
            m1[Sum]++;
        }

        int Max = 0;
        for (auto& e : m1)
        {
            Max = e.second > Max ? e.second : Max;
        }
        /*
        for(auto& e : m1)
        {
            cout << e.first << ":" << e.second << endl;
        }
        */

        return Max;
    }
};